package gui;

import abstractmodel.*;
import configure.ConfigureInfo;
import java.awt.Font;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import javax.swing.JFrame;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.FontUIResource;
import org.jvnet.substance.SubstanceLookAndFeel;
import reminder.ReminderFrontActor;




/**
 *
 * @author littlechild
 */
public class Main {
    public static IModelFactory mf=null;
    public static ReminderFrontActor reminderClient=new reminder.ReminderFrontActor();
    public static MainFrame frame=null;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        try {
            mf = ModelFactoryProducer.getModelFactory(ConfigureInfo.getProperty(ConfigureInfo.ModelFactoryClassName));
            //GlobalOutLook.setFontAll(new FontUIResource("宋体", Font.PLAIN, 12));
            initLookAndFeel();
            frame=new MainFrame();
            frame.setLocationRelativeTo(null);
            //GlobalOutLook.setFontAll(new FontUIResource("宋体", Font.PLAIN, 12));
            frame.setVisible(true);
            reminder.ReminderBackActor.main(new String[]{""});
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
        static void initLookAndFeel() {
        try {
            FontUIResource font = new FontUIResource("宋体", Font.PLAIN, 12);
            GlobalOutLook.setFontAll(font);
            String[] lookAndFeelList = new String[]{"SubstanceAutumnLookAndFeel", "SubstanceBusinessBlackSteelLookAndFeel", "SubstanceBusinessBlueSteelLookAndFeel", "SubstanceBusinessLookAndFeel", "SubstanceChallengerDeepLookAndFeel", "SubstanceCremeLookAndFeel", "SubstanceEmeraldDuskLookAndFeel", "SubstanceFieldOfWheatLookAndFeel", "SubstanceGreenMagicLookAndFeel", "SubstanceMagmaLookAndFeel", "SubstanceMangoLookAndFeel", "SubstanceModerateLookAndFeel", "SubstanceOfficeBlue2007LookAndFeel", "SubstanceOfficeSilver2007LookAndFeel", "SubstanceRavenGraphiteGlassLookAndFeel", "SubstanceRavenGraphiteLookAndFeel", "SubstanceRavenLookAndFeel", "SubstanceSaharaLookAndFeel"};
            for (String className : lookAndFeelList) {
                LookAndFeel lf;
                try {
                    lf = (LookAndFeel) Class.forName("org.jvnet.substance.skin." + className).newInstance();
                    UIManager.installLookAndFeel(lf.getName(), lf.getClass().getName());
                } catch (InstantiationException ex) {
                    ex.printStackTrace();
                } catch (ClassNotFoundException ex) {
                    ex.printStackTrace();
                } catch (IllegalAccessException ex) {
                    ex.printStackTrace();
                }
            }
            UIManager.installLookAndFeel(new SubstanceLookAndFeel().getName(), new SubstanceLookAndFeel().getClass().getName());
            UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceFieldOfWheatLookAndFeel");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
